<!-- 轮播图下面的第一个显示区 -->
<template>
    <div class="recommend">
        <div v-for="(item,index) in recommends" :key="index" class="recommend-item">
            <a :href="item.link">
                <img :src="item.image" alt="" @load="imgLoaded">
                <div>{{item.title}}</div>
            </a>
        </div>
    </div>
</template>

<script>
export default {
    name:'HomeRecomendView',
    props: {
        recommends:{
            type:Array,
            default(){
                return [];
            }
        }
    },
    data () {
        return {
            isload:false
        }
    },
    methods: {
        imgLoaded() {
            if (!this.isload) {
                this.$emit('imgLoaded');
                this.isload = true
            }
        }
    }
}
</script>

<style scoped>
    .recommend{
        display: flex;
        width: 100%;
        text-align: center;
        padding: 10px 0 20px;
        font-size: 12px;
        border-bottom: 8px solid #eee;
    }
    .recommend-item{
        flex: 1;
    }
    .recommend-item img{
        width: 70px;
        height: 70px;
        margin-bottom: 10px;
    }
</style>